package com.dgut.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dgut.cache.MybatisRedisCache;
import com.dgut.pojo.Notice;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@CacheNamespace(implementation = MybatisRedisCache.class,eviction=MybatisRedisCache.class)
public interface NoticeMapper extends BaseMapper<Notice> {
    @Select("SELECT count(*) FROM law_service.notice where receiver_id = #{id} and state = #{state}")
    int selectNoticeCount(int id,String state);
    @Update({ "update notice set state= #{state} where id = #{id} and receiver_id = #{userId}" })
    int readNotice(int id,int userId,String state);
    @Select("SELECT service_id FROM law_service.legal_recourse where service_id != -1 and service_id != #{serviceProviderId} and id = #{legalRecourseId}")
    int[] getServiceProviderIds(int legalRecourseId,int serviceProviderId);
}
